package com.skateboard.reelviewtest

import android.animation.ObjectAnimator
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.skateboard.reelviewtest.utils.SimpleUtils
import kotlinx.android.synthetic.main.activity_test_translation.*

class TestTranslationActivity : AppCompatActivity(), View.OnClickListener {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_test_translation)
        button.setOnClickListener(this)
    }

    override fun onClick(v: View?) {
        testTranslation()
    }

    private fun testTranslation(){
        //相对自身位置
        val animator: ObjectAnimator = ObjectAnimator.ofFloat(button, "translationY", SimpleUtils.getScreenHight(this)/2)
        animator.duration = 1000
        animator.start()

    }
}